

const local = {
  set: (key, value) => {
    localStorage.setItem(key, JSON.stringify(value));
  },
  get: (key) => {
    const value = localStorage.getItem(key);
    return value ? JSON.parse(value) : value;
  },
  remove: (key) => {
    localStorage.removeItem(key);
  },
  clear: () => {
    localStorage.clear();
  },
};
const session = {
  set: (key, value) => {
    sessionStorage.setItem(key, JSON.stringify(value));
  },
  get: (key) => {
    const value = sessionStorage.getItem(key);
    return value ? JSON.parse(value) : value;
  },
  remove: (key) => {
    sessionStorage.removeItem(key);
  },
  clear: () => {
    sessionStorage.clear();
  },
};

const STORAGE_KEY = {
  TOKEN:'TOKEN',
  USER:'USER',
  CACHE_USER:'CACHE_USER',
}
export { local, session, STORAGE_KEY };
